#include ".MODULE/cpp/wa_interface.h"


/************* Function Block counter *************/
void *
__init_counter(counter_FUNCTION_BLOCK *self) {
    self->IN1 = 0;
    self->CNT = 0;
    return nullptr;
}

void
counter(counter_FUNCTION_BLOCK *self, void *instance) {
    self->CNT += self->IN1;
}

// if return -1: error, the required size is stored in the buffer.
int counter_save(void *instance, void *buffer, int size) {
    return 0;
}

bool counter_restore(void *instance, void *instance_data, int size) {
    return true;
}
/*********** End Function Block counter ***********/
